#pragma once

#include <iostream>
#include <d3dx9core.h>
#include <cstringt.h>

#define FONT_SIZE 35
using namespace std;

class Font
{
private:
	ID3DXFont* _Font;
public:

	Font(void);
	~Font(void);
	
	void DrawTextString(LPD3DXSPRITE SpriteHandle, int x, int y, int Width, int Height, LPCSTR s)
	{
		LPDIRECT3DDEVICE9 d3ddv;
		SpriteHandle->GetDevice(&d3ddv);

		_Font = NULL;
		D3DXFONT_DESC FontDesc = {FONT_SIZE,
                          0,
                          700,
                          0,
                          false,
                          DEFAULT_CHARSET,
                          OUT_TT_PRECIS,
                          CLIP_DEFAULT_PRECIS,
                          DEFAULT_PITCH,
                          L"Arial"};
		RECT FontPosition;
		FontPosition.top = x;
		FontPosition.left = y;
		FontPosition.right = Width;
		FontPosition.bottom = Height;

		D3DXCreateFontIndirect(d3ddv, &FontDesc, &_Font);
		_Font->DrawTextA(
			NULL,
			s,
			-1,
			&FontPosition,
			DT_CENTER || DT_VCENTER ,
			D3DCOLOR_XRGB(0, 0, 0));
	}
};

